package org.zfes.snowier.cloud.zbss.loan.loan.controller;

import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.loan.loan.model.LoanBankProduct;
import org.zfes.snowier.cloud.zbss.loan.loan.service.ILoanBankProductService;
@Controller 
@RequestMapping("/loan/loanBankProduct")
public class LoanBankProductController extends BaseController {

	
	@Autowired
	private ILoanBankProductService loanBankProductService;
	
	//@RequiresPermissions(value="loanBankProduct:loadLoanBankProductDataSet",desc="产品信息列表")
    @RequestMapping(value="/loadLoanBankProductDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadLoanBankProductDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  loanBankProductService.loadLoanBankProductDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	//@RequiresPermissions(value="loanBankProduct:createLoanBankProduct",desc="产品信息添加")
    @RequestMapping(value="/createLoanBankProduct", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public  @ResponseBody Object createLoanBankProduct(LoanBankProduct loanBankProduct){
		loanBankProductService.createLoanBankProduct(loanBankProduct);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	//@RequiresPermissions(value="loanBankProduct:loadLoanBankProduct",desc="产品信息加载")
    @RequestMapping(value="/loadLoanBankProduct", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadLoanBankProduct(Long id){
		Optional<LoanBankProduct> ops = loanBankProductService.loadLoanBankProductById(id);
		return ops;
    }
	
	//@RequiresPermissions(value="loanBankProduct:updateLoanBankProduct",desc="产品信息更新")
    @RequestMapping(value="/updateLoanBankProduct", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object updateLoanBankProduct(LoanBankProduct loanBankProduct){
		loanBankProductService.updateLoanBankProduct(loanBankProduct);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	//@RequiresPermissions(value="loanBankProduct:deletLoanBankProduct",desc="产品信息删除")
    @RequestMapping(value="/deleteLoanBankProduct", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object deleteLoanBankProduct(Long id){
		loanBankProductService.deleteLoanBankProduct(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }

}